import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ListMethod {

    public static void main(String[] args) {

        removeIf();
    }

    public static void test() {
        List list = new ArrayList();
        list.add("1");
        list.add(1, "2");
        list.add(0, "3");
        list.add("2");
        System.out.println(list.get(0));
        System.out.println(list);
        // 第一次出现的下标
        System.out.println(list.indexOf("2"));
        list.set(2, "list");
        System.out.println(list);
        System.out.println(list.subList(0, 2));
    }

    public static void removeIf() {
        ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(null, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
        list.removeIf(item -> item == null ? true : false);
        System.out.println(list);
    }
}